[Perf][Spec Decode] Fuse target temperature in rejection sampler - #53090
Open
positive666 wants to merge 2 commits into
Open
[Perf][Spec Decode] Fuse target temperature in rejection sampler#53090positive666 wants to merge 2 commits into
positive666 wants to merge 2 commits into
Conversation
positive666
requested review from
WoosukKwon,
njhill and
yewentao256
as code owners
August 20, 2026 09:42
positive666
marked this pull request as draft
August 20, 2026 10:02
Avoid materializing an FP32 target-logits buffer for temperature-only speculative decoding requests by applying temperature in the rejection kernels. Assisted-by: OpenAI Codex Signed-off-by: Cheng Rui <286040359@qq.com>
Exercise temperature-only speculative sampling during startup and extend parity coverage across FP16, multi-block vocabularies, and synthetic verification. Assisted-by: OpenAI Codex Signed-off-by: Cheng Rui <286040359@qq.com>
positive666
force-pushed
the
perf/spec-rejection-temperature-fusion
branch
from
August 20, 2026 12:37
28eb653 to
bceeaff
Compare
positive666
marked this pull request as ready for review
August 20, 2026 15:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fuse target-temperature scaling into the MRV2 rejection-sampling kernels for temperature-only requests. This avoids materializing an FP32 target-logits buffer and removes chunking on this path.
Requests using other logits processors or processed logprobs keep the existing fallback. Startup warmup compiles the fused variants to avoid first-request JIT compilation.
Results
L40S, BF16 target logits, vocabulary 151936, speculative K=4:
At batch 128, peak temporary allocation decreased from 371.4 MiB to 0.5 MiB (370.9 MiB saved).
Two five-round Qwen3.5-9B end-to-end comparisons (ngram K=4, 128 prompts, 64 output tokens) remained within run-to-run noise: -0.66% and +0.99%. These are rejection-sampler gains; no end-to-end throughput improvement is claimed.
A fresh Triton-cache run confirmed that the fused rejection-sampler kernels do not compile during inference after startup warmup.
Tests
Coverage includes FP32/FP16/BF16 target logits, one-hot/full draft logits, standard/block/synthetic verification, mixed temperatures, multi-block vocabularies, and fallback paths.
Benchmark commands:
Duplicate check
No equivalent open PR was found. #41258 and #45369 target the legacy sampler. #48928 targets FlashInfer AIR top-p sampling, while this fast path excludes top-p.
AI assistance
AI assistance was used for implementation and validation. The submitter reviewed every changed line and ran the tests above.